﻿<%@ Page Title="Department" Language="C#" MasterPageFile="~/POS.master" AutoEventWireup="true" CodeFile="~/Admin/AddDepartment.aspx.cs" Inherits="Admin_AddDepartment" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
     <div class="container">
        <div class="form-horizontal" id="divCustomerWrapper">
             <div class="form-group">
                <label class="control-label col-sm-4" for="Name">Company :</label><asp:Label Text="" ID="Label1" runat="server" />
                <div class="col-sm-6">
                    <asp:DropDownList ID="DDL_Company" OnSelectedIndexChanged="DDL_Company_SelectedIndexChanged" AutoPostBack="true" DataTextField="CompanyName" DataValueField="CompanyId" runat="server">
                    </asp:DropDownList>
                   </div>
            </div>
             <div class="form-group">
                <label class="control-label col-sm-4" for="Name">Branch :</label><asp:Label Text="" ID="Label2" runat="server" />
                <div class="col-sm-6">
                    <asp:DropDownList ID="DDL_Branch" OnSelectedIndexChanged="DDL_Branch_SelectedIndexChanged" AutoPostBack="true" DataTextField="BranchName" DataValueField="BranchId" runat="server">
                    </asp:DropDownList>
                   </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4" for="Name">Department Name :</label>
                <div class="col-sm-6">
                    <asp:TextBox runat="server" id="txtDepartmentName" class="form-control" placeholder="Department Name" />
                    <asp:RequiredFieldValidator ErrorMessage="Enter Department Name" ForeColor="Red" ControlToValidate="txtDepartmentName" runat="server" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-4 col-sm-8">
                    <asp:Button runat="server"  id="btnSaveDepartment" Cssclass="btn btn-success" Text="Save" onclick="btnSaveDepartment_Click" />
                    <asp:Button runat="server" ID="btnClearForm" CssClass="btn btn-danger" Text="Clear Form" CausesValidation="false" OnClick="btnClearForm_Click" />
               
                     </div>
            </div>
        </div>
               <asp:GridView runat="server" ID="GridViewDepartments" AutoGenerateColumns="false" CssClass="col-sm-10 grid" AllowPaging="true" PageSize="5" 
            AlternatingRowStyle-BackColor="#ccffff" >
            <Columns>
                <asp:TemplateField HeaderText="Sr.#">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Company">
                    <ItemTemplate>
                        <asp:Label ID="lblcompany"  Text='<%#Bind("CompanyName") %>' runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Branch">
                    <ItemTemplate>
                        <asp:Label ID="lblBranch"  Text='<%#Bind("BranchName") %>' runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                 <asp:TemplateField HeaderText="Department">
                    <ItemTemplate>
                        <asp:Label ID="lblDepartment" Text='<%#Bind("Dept_Name") %>' runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtnEditDepartment" CausesValidation="false" Text="Edit" CommandArgument='<%#Bind("Dept_Id") %>' OnClick="lbtnEditDepartment_Click" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                 <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtnDeleteBranch" CausesValidation="false" Text="Delete" CommandArgument='<%#Bind("Dept_Id") %>' OnClick="lbtnDeleteBranch_Click" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
</asp:Content>

